/*
 * WIEGAND.c
 *
 * Created: 13.02.2013 16:08:09
 *  Author: saenko
 */ 
#include <avr/io.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/delay.h>




#include "uart.h"
#include "wgnd.h"


int main(void)
{	
	
	uart_init();
	wiegand_init();
	sei();
	
	printstr_p(PSTR("ATMega88 is ready\n"));	
	
    while(1)
    {
        if(uart_flags.rxstring_end)
		{
			uart_flags.rxstring_end = 0;
			printstr_p(PSTR("ATMega88 is ready\n"));
		}	
	
		if(wiegand_frame)
		{
			wiegand_frame = 0;
			for(unsigned char i = 0; i<wiegand_count;i++) putchr(wiegand_buf[wiegand_count]);
			putchr('*');
			wiegand_count = 0;
		}		
    }
}